﻿using System;

namespace BizElements.Core
{
    /// <summary>Provides immutable data used to create <see cref="DbRelation"/> objects.</summary>
    public interface IDbRelationConfiguration
    {
        /// <summary>Parent table/meta class.</summary>
        Type ParentClass { get; }

        /// <summary>Names of parent primary key columns.</summary>
        string[] ParentPrimaryKeyColumnNames { get; }

        /// <summary>Optional parent table alias.</summary>
        string ParentAlias { get; }

        /// <summary>Creates an instance of parent table/meta class. Sets alias if <see cref="ParentAlias"/> property is not null.</summary>
        /// <returns>Parent metadata class.</returns>
        IDbTable CreateParent();

        /// <summary>Child table/meta class.</summary>
        Type ChildClass { get; }

        /// <summary>Names of child foreign key columns.</summary>
        string[] ChildForeignKeyColumnNames { get; }

        /// <summary>Optional child table alias.</summary>
        string ChildAlias { get; }

        /// <summary>Creates an instance of child table/meta class. Sets alias if <see cref="ChildAlias"/> property is not null.</summary>
        /// <returns>Child metadata class.</returns>
        IDbTable CreateChild();        
    }
}